{include file="../app/view/common/header.html" page="rank" subtitle="学习排行榜"}
<style>
    .facer
    {
        position: absolute;
        left: 30%;
        top: 50%;
        transform: translateX(-50%) translateY(-50%);
        border-radius: 50%;
        width: 80px;
        box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
    }
    .rank-item
    {
        position: relative;
        height: 150px;
        box-shadow: rgb(38, 57, 77) 0px 20px 30px -10px;
    }
    .number-item
    {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        font-size: 50px;
        height: 100%;
        left: 0px;
        width: 20%;
        color: rgb(243, 151, 5);
        text-align: center;
        line-height:150px;
        font-family: hei;
    }
    .name-item
    {
        position: absolute;
        left: 43%;
        font-family: hei;
        font-size: 300%;
        line-height:150px;
    }
    .time-item
    {
        position: absolute;
        left: 75%;
        font-family: hei;
        font-size: 300%;
        line-height:150px;
        color: rgb(240, 5, 5);
    }
</style>
<div id="root">

</div>

<script>
    ELE = `
        <div class="rank-item">
            <div class="number-item">RANK</div>
            <img class="facer" src="FACERIMG">
            <div class="name-item">NAMENAME</div>
            <div class="time-item">TIMETIME</div>
        </div>
    `
    $.get("/study/api/rank",function(data) {
        for (i in data) {
            ele = data[i]
            document.getElementById("root").innerHTML += ELE
                                                    .replaceAll("RANK",(parseInt(i)+1))
                                                    .replaceAll("FACERIMG",getFacerPath(ele.uid))
                                                    .replaceAll("NAMENAME",sysuser[ele.uid].realname)
                                                    .replaceAll("TIMETIME",(ele.time/60).toFixed(2))
        }
        
    })
</script>